package com.zmn.plat.persistence.interfaces.channel;

import com.zmn.plat.model.entity.channel.ChannelCityPriceRatio;
import com.zmn.plat.model.entity.channel.ChannelCityPriceRatioQuery;
import com.zmn.plat.model.vo.channel.ChannelCityPriceRatioVo;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface ChannelCityPriceRatioDAO {

    /**
     * 查询
     * @param ratioId ID
     * @return
     */
    ChannelCityPriceRatio findByKey(Integer ratioId);

    /**
     * 分页搜索
     * @param query 条件
     * @return 列表
     */
    List<ChannelCityPriceRatioVo> listPageByQuery(ChannelCityPriceRatioQuery query);

    /**
     * 搜索
     * @param query 条件
     * @return
     */
    List<ChannelCityPriceRatio> listByQuery(ChannelCityPriceRatioQuery query);

    /**
     * 所有数据
     * @return
     */
    List<ChannelCityPriceRatio> listAll();

    /**
     * 统计
     * @param query 条件
     * @return
     */
    Integer countByQuery(ChannelCityPriceRatioQuery query);
    /**
     * 更新
     * @param baseCityRatio
     * @return
     */
    Integer updateByKey(ChannelCityPriceRatio baseCityRatio);

    /**
     * 描述: 批量修改待生效系数
     *
     * @param updateRatioList 待生效系数集合
     * @return
     * @auther linfeng
     * @since 2020/8/26 17:46
     */
    void updateToBeEffectiveRatioBatch(@Param("updateRatioList") List<ChannelCityPriceRatio> updateRatioList);

    /**
     * 描述: 将预生效的渠道城市系数生效
     *
     * @param ratioList
     * @return: 执行结果码
     * @auther: linfeng
     * @since: 2020/09/03 17:46
     */
    Integer updateRatioByKeyBatch(@Param("ratioList") List<ChannelCityPriceRatio> ratioList);

    /**
     * 插入
     * @param baseCityRatio
     * @return
     */
    Integer insert(ChannelCityPriceRatio baseCityRatio);

    /**
     * 批量插入系数
     * @param channelCityRatioList
     * @return
     */
    Integer insertBatch(@Param("channelCityRatioList") List<ChannelCityPriceRatio> channelCityRatioList);

    /**
     * 删除
     * @param ratioId ID
     * @return
     */
    Integer deleteByKey(Integer ratioId);

    /**
     * 批量删除
     * @param ratioIds
     * @return
     */
    Integer deleteByKeys(@Param("ratioIds") List<Integer> ratioIds);

    /**
     * 复制系数
     * @param sourceChannelId
     * @param targetChannelId
     * @param bizType
     * @param priceType
     * @param ratioTypes
     * @param opertor
     * @return
     */
    Integer copyRatio(@Param("sourceChannelId") Integer sourceChannelId, @Param("targetChannelId") Integer targetChannelId, @Param("bizType") Integer bizType, @Param("priceType") Integer priceType, @Param("effectiveDate") Date effectiveDate, @Param("ratioTypes") List<Integer> ratioTypes, @Param("opertor") String opertor);

    /**
     * 描述: 根据主键批量删除
     *
     * @param deleteIdList 主键ID集合
     * @return
     * @auther linfeng
     * @since 2020/3/17 17:06
     */
    void deleteByIdList(@Param("deleteIdList") List<Integer> deleteIdList);

    /**
     * 根据channelId和priceType和bizType和ratioTypes删除系数
     * @param channelId
     * @param priceType
     * @param bizType
     * @param ratioTypes
     * @return
     */
    Integer deleteByChannelIdAndPriceTypeAndBizTypeAndRatioTypes(@Param("channelId") Integer channelId, @Param("priceType") Integer priceType, @Param("bizType") Integer bizType, @Param("ratioTypes") List<Integer> ratioTypes);

    /**
     * 描述: 从旧渠道复制到新渠道
     *
     * @param originalChannelId 原渠道ID
     * @param targetChannelId 新渠道ID
     * @param operator 操作者
     * @return java.lang.Boolean
     * @author guoqiao
     * @since 2021/6/8 13:49
     */
    void copy(Integer originalChannelId, int targetChannelId, String operator);
}